home *** CD-ROM | disk | FTP | other *** search
/ DarkBASIC - The Ultimate 3D Game Creator / PCactive 8 CD1 - DarkBasic.iso / SOFTWARE / DEMOS / DarkForge2000 / snippets_vol4 / snip_realfire.dba < prev    next >
Encoding:
Text File  |  2000-10-17  |  1.4 KB  |  75 lines

  1. `    ------------------------------------------------------------------------
  2. `    Real Fire                                 DarkForge Snippet (11/10/2000)
  3. `    ------------------------------------------------------------------------
  4. `    Coded by S. Lintula (sasu@dpoy.vip.fi) and optimised by R. Davey
  5. `    Based on the fire code from Snippets Vol 3, this is a very nice piece of
  6. `    work indeed! Change the number of flames/sparks created per frame.
  7.  
  8. set display mode 320,240,16
  9.  
  10. hide mouse
  11. sync rate 0
  12. sync on 
  13.  
  14. create bitmap 1,320,60 
  15.  
  16. `    Number of flames to create per frame
  17.  
  18. flames = 50
  19. sparks = 6
  20.  
  21. do
  22.  
  23.     for n=0 to flames
  24.  
  25. `        Draw the flame
  26.  
  27. `        Traditional red flames
  28.         ink rgb(255,63,0),0
  29.  
  30. `        Green flames
  31. `        ink rgb(64,255,0),0
  32.  
  33. `        Blue vapour
  34. `        ink rgb(0,64,255),0
  35.  
  36.         x=rnd(319)
  37.         line x,59,x+rnd(4),59 
  38.     
  39. `        Draw hole between flames 
  40.     
  41.         ink 0,0
  42.         x=rnd(319) 
  43.         line x,59,x+rnd(1),59 
  44.  
  45.     next n
  46.  
  47. `    Draw the sparks
  48.  
  49.     ink rgb(255,255,255),0
  50.     for n=0 to sparks
  51.  
  52.         dot rnd(319),59-rnd(2)
  53.  
  54.     next n
  55.  
  56.     blur bitmap 1,1
  57.  
  58. `    The following code addresses an issue with the blur command shifting
  59. `    the blur effect to the right each time. This repositions the flame.
  60.  
  61.     if frame = 1
  62.         copy bitmap 1,1,0,319,59,1,0,0,318,59
  63.         frame = 0
  64.     else
  65.         inc frame 
  66.     endif
  67.     
  68.     copy bitmap 1,0,1,319,59,1,0,0,319,58
  69.     copy bitmap 1,0,0,319,55,0,0,60,319,239
  70.  
  71.     sync
  72.  
  73. loop
  74.  
  75.